package com.hmall.common.clients;

import com.hmall.common.dto.Address;
import com.hmall.common.dto.Item;
import com.hmall.common.vo.ItemVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("itemservice")
public interface ItemClient {
    @GetMapping("/item/page")
    List<Item> findAllGoods(@RequestParam("page") Long currentPage, @RequestParam("size") Long pageSize);
    @GetMapping(value = "/item/{id}",produces = "application/json;charset=utf-8")
    ItemVo findById(@PathVariable("id") Long id);
    @GetMapping(value ="/address/{id}",produces = "application/json;charset=utf-8")
    Address findAddressById(@PathVariable("id") Long id);
    @GetMapping("/item/reduceStock/{id}/{num}")
    void reduceStock(@PathVariable("id") Long id, @PathVariable("num") Integer num);
    @GetMapping("/item/restoreStock/{id}/{num}")
    void restoreStock(@PathVariable("id") Long id, @PathVariable("num") Integer num);
}
